require("SOD/tools/dialogs/dialog.rb")
require("SOD/ProjectManager.rb")

module SOD
  
  class VersioningDialog < SOD_Dialog # see OS Dialog
    
    def initialize(title = "Default", scrollbars = true, w = 660, h = 580, l = 150, t = 150)
      super
      set_file("versioning.html")
      add_callbacks
    end
    
    def onLoad
      update
    end
    
    def update
      
      @projectName = Plugin.projectManager.activeProjectName
      @var1 = Plugin.projectManager.activeFileName
      puts @var1
      if !@var.nil?
        @var1 = "No File Loaded!"
      end
      
      set_element_value("PROJECT", @projectName)
      set_element_value("VARIANT_1", @var1)
      
      fileNames = Plugin.projectManager.projectFileList
      fileNames.remove(@var1.to_s)
      
      set_select_options("VARIANT_2", fileNames.to_a)
      
      #@hash['PROJECT'] = "Pname" #Plugin.projectManager.activeProjectName
      #@hash['VARIANT_1'] = "Vname" #Plugin.projectManager.activeFileName
      #@hash['VARIANT_2'] = "Vname" #Plugin.projectManager.activeFileName
      #
      #@hash.keys.each { |key| set_element_value(key, @hash[key]) }
    end
    
  end
  
end
